<template>
  <div class="home">
    <el-container class="big_box">
      <el-header style="display:flex;align-items: center;">
          <div class="header_left">
              
          </div>
          <div class="header_center">
              <p>管理系统</p>
          </div>
          <Userinfo/>
      </el-header>
      <el-container>
        <el-aside width="200px">
            <Leftnav/>
        </el-aside>
        <el-main>
            
            <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import Userinfo from './ui/userinfo.vue'
import Leftnav from './ui/leftnav.vue'
import { GET_USERS } from '../../store/actionType'
import { createNamespacedHelpers } from 'vuex'
let { mapActions , mapState } = createNamespacedHelpers('user')
export default {
    data() {
        return {
            userInfo:null
        }
    },
    components:{
        Userinfo,
        Leftnav
    },
    computed:{
        ...mapState(['userinfo'])
    },
    methods: {
        ...mapActions([GET_USERS])
    },
    mounted() {
        this[GET_USERS]().then(res=>{
            console.log(res);
            if(!res)this.$router.push('/login')
        })
    },

};
</script>

<style lang="scss" scoped>
    .big_box{
        height: 100%;
    }
    .el-header{

    .header_left{
        // background: red;
        
        height: 50px;
        width: 50px;
        background-image: url('../../assets/images/logo.png') ;

        background-size: 100%;
        border-radius: 50%;

    }
    .header_center{
        p{
            font-size: 20px;
            letter-spacing:10px;
            color: #fff;
        }
    }
    
    display: flex;
    justify-content: space-between;
    // background-color: #B3C0D1;
    background-color: rgb(32,51,64);
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    height: calc(100vh - 60px);
    text-align: center;
    line-height: 200px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    height: calc(100vh - 60px);

    text-align: center;
    // line-height: 160px;
  }
  

  

</style>